knitr::opts_chunk$set(message = FALSE, echo = FALSE)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0 ✔ purrr 1.0.1
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.5.0
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## Loading required package: grid
## Loading required package: gnm
##
## Attaching package: 'vcdExtra'
##
## The following object is masked from 'package:dplyr':
##
## summarise
library(sjPlot)
library(ggmosaic)
##
## Attaching package: 'ggmosaic'
##
## The following objects are masked from 'package:vcd':
##
## mosaic, spine
library(ggpubr)
#install.packages("openintro")
library(openintro)
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata
Introduction
Let us play with some categorical ( or predominantly categorical )
datasets in R and se how we can analyze and plot them.
The
titanic dataset
titanic Bar Plots
titanic Mosaic Plot
titanic Balloon Plot
The
hippocorpus dataset from Kaggle